﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PACKETPARSERMAX20.CORE.UPDATEFIELDS;

namespace PACKETPARSERMAX20.CORE
{
    public class WoWObjectPlayer : WoWObjectUnit
    {
        public WoWObjectPlayer(WoWCore sender, UInt64 guid, TypeID pTypeID)
            : base(sender, guid, pTypeID)
        {

        }

        public override string Name
        {
            get
            {
                if (base.Name == null)
                {
                    if (Sender.PlayerGUID == Guid)
                    {
                        if (Sender.CharEnumInfoList.ContainsKey(Guid))
                            base.Name = Sender.CharEnumInfoList[Guid].Name;
                    }
                    else
                    {
                        if (Sender.NameQueryResponseInfoList.ContainsKey(Guid))
                        {
                            base.Name = Sender.NameQueryResponseInfoList[Guid].Name;
                        }
                    }
                }

                return base.Name;
            }

            internal set
            {
                base.Name = value;
            }
        }

        public uint PLAYER_FLAGS
        {
            get
            {
                if (TypeID == TypeID.TYPEID_PLAYER)
                    return (uint)GetUpdateValue("PLAYER_FLAGS", typeof(uint));
                return 0;
            }
        }
    }
}
